The global display object has always a longer lifetime than anything
that is initialized from JS, so avoid signals that it may emit to be
handled at later point.
It handles issues such as:
(gnome-shell:2429): Gjs-CRITICAL **: 23:18:35.025: Object
Gjs_ui_messageTray_MessageTray (0x3440ed60), has been already disposed —
impossible to set any property on it.
This might be caused by the object having been destroyed from C code using
something such as destroy(), dispose(), or remove() vfuncs.
== Stack trace for context 0x31073eb0 ==
#0
348db378 i resource:///org/gnome/shell/ui/messageTray.js:1046 (
3a8ac3a71f60 @ 104)
#1
348db2d8 i resource:///org/gnome/shell/ui/main.js:277 (
3a8ac3a0b100 @ 119)
Seen in: https://gitlab.gnome.org/GNOME/gnome-shell/-/jobs/
5846454
Part-of: <https://gitlab.gnome.org/GNOME/gnome-shell/-/merge_requests/3987>
Main.layoutManager.addChrome(this);
Main.layoutManager.trackChrome(this._bannerBin);
- global.display.connect('in-fullscreen-changed', this._updateState.bind(this));
+ global.display.connectObject('in-fullscreen-changed',
+ () => this._updateState(), this);
Main.sessionMode.connect('updated', this._sessionUpdated.bind(this));